{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Tensorflow(pb) 转 ONNX\n",
    "\n",
    "参考: [TVM Tensorflow 前端](https://xinetzone.github.io/tvm/docs/arch/frontend/tensorflow.html)\n",
    "\n",
    "下面以 [mobilenet_v2 float_v2_1.4_224](https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.4_224.tgz) 为例，展示 Tensorflow pb 模型转换为 ONNX 模型的过程:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import os\n",
    "import warnings\n",
    "os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n",
    "import tensorflow as tf\n",
    "tf.get_logger().setLevel(\"ERROR\")\n",
    "warnings.simplefilter(\"ignore\")\n",
    "import tensorflow as tf\n",
    "from tensorflow.core.framework.graph_pb2 import GraphDef"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import set_env # 加载 TVM\n",
    "import tvm.relay.testing.tf as tf_testing\n",
    "class MobilenetV2(tf.keras.Model):\n",
    "    def __init__(self, *args, **kwargs):\n",
    "        super().__init__(*args, **kwargs)\n",
    "        path_model = tf_testing.get_workload_official(\n",
    "            \"https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.4_224.tgz\",\n",
    "            \"mobilenet_v2_1.4_224_frozen.pb\"\n",
    "        )\n",
    "        self.graph_def = self._read_graph_def(path_model)\n",
    "        self.output_names = ['output']\n",
    "    \n",
    "    def _read_graph_def(self, frozen_path):\n",
    "        with open(frozen_path, 'rb') as f:\n",
    "            graph_def = GraphDef()\n",
    "            graph_def.ParseFromString(f.read())\n",
    "        return graph_def\n",
    "    \n",
    "    @tf.function(input_signature=[tf.TensorSpec([1, 3, 224, 224], \n",
    "                                                 tf.float32, name=\"input\")])\n",
    "    def call(self, x):\n",
    "        x = tf.convert_to_tensor(x, tf.float32) # 确保输入是 tensor\n",
    "        x = tf.transpose(x, perm=(0, 2, 3, 1)) # NCHW -> NHWC\n",
    "        x = tf.graph_util.import_graph_def(\n",
    "            self.graph_def, input_map={'input:0': x}, \n",
    "            return_elements=['MobilenetV2/Predictions/Reshape_1:0']\n",
    "            # return_elements=[\"MobilenetV2/Logits/AvgPool:0\"]\n",
    "            # return_elements=[\"MobilenetV2/Logits/Conv2d_1c_1x1/BiasAdd:0\"]\n",
    "        )[0]\n",
    "        return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n",
      "I0000 00:00:1726190666.909964 1341751 devices.cc:67] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 2\n",
      "I0000 00:00:1726190668.185528 1341751 devices.cc:67] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 2\n"
     ]
    }
   ],
   "source": [
    "import tf2onnx\n",
    "import onnx\n",
    "\n",
    "input_signature = [tf.TensorSpec([1, 3, 224, 224], tf.float32, name=\"data\")]\n",
    "model = MobilenetV2()\n",
    "onnx_model, _ = tf2onnx.convert.from_keras(model, input_signature)\n",
    "onnx.save(onnx_model, \".temp/mobilenet_v2_tf.onnx\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "测试一致性:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from PIL import Image\n",
    "image_size = 224\n",
    "path = 'images/Giant_Panda_in_Beijing_Zoo_1.jpg' # 将要预测的图片路径\n",
    "\n",
    "with Image.open(path) as im:\n",
    "    if im.mode != \"RGB\":\n",
    "        im.convert(\"RGB\")\n",
    "    im = im.resize((224, 224))\n",
    "    image = np.asarray(im)\n",
    "image = image/128 -1\n",
    "images = np.expand_dims(image, 0)\n",
    "images = images.transpose((0, 3, 1, 2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = MobilenetV2()\n",
    "tf_output = model(images)\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import set_env\n",
    "import tvm\n",
    "from tvm import relay\n",
    "from tvm.relay.frontend import from_onnx\n",
    "\n",
    "shape_dict = {\"data\": [1, 3, 224, 224]}\n",
    "mod, params = from_onnx(\n",
    "    onnx_model,\n",
    "    shape_dict,\n",
    "    freeze_params=True\n",
    ")\n",
    "with tvm.transform.PassContext(opt_level=3):\n",
    "    lib = relay.build(mod, \"llvm\", params=params)\n",
    "inputs_dict = {\"data\": images}\n",
    "mlib_proxy = tvm.contrib.graph_executor.GraphModule(lib[\"default\"](tvm.cpu()))\n",
    "mlib_proxy.run(**inputs_dict)\n",
    "np.testing.assert_allclose(\n",
    "    tf_output.numpy(), \n",
    "    mlib_proxy.get_output(0).numpy(),\n",
    "    rtol=1e-02, atol=1e-5\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tvm.contrib.msc.core.frontend import translate\n",
    "\n",
    "graph, weights = translate.from_relay(mod, params, opt_config={\"opt_level\": 3})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "main <INPUTS: data:0| OUTPUTS: reshape_2:0>\n",
       "ID_0 data <PARENTS: | CHILDERN: msc.conv2d_bias_52>\n",
       "  OUT: data:0(data)<1,3,224,224|float32>\n",
       "  OPTYPE: input\n",
       "\n",
       "ID_1 msc.conv2d_bias_52 <PARENTS: data| CHILDERN: clip>\n",
       "  IN: data:0(data)<1,3,224,224|float32>\n",
       "  OUT: msc.conv2d_bias_52:0<1,48,112,112|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=2,2 kernel_layout=OIHW groups=1 channels=48 kernel_size=3,3 axis=1 padding=0,0,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_104<48,3,3,3|float32>\n",
       "    bias: const_105<48|float32>\n",
       "\n",
       "ID_2 clip <PARENTS: msc.conv2d_bias_52| CHILDERN: msc.conv2d_bias_51>\n",
       "  IN: msc.conv2d_bias_52:0<1,48,112,112|float32>\n",
       "  OUT: clip:0<1,48,112,112|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_3 msc.conv2d_bias_51 <PARENTS: clip| CHILDERN: clip_1>\n",
       "  IN: clip:0<1,48,112,112|float32>\n",
       "  OUT: msc.conv2d_bias_51:0<1,48,112,112|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=48 channels=48 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_102<48,1,3,3|float32>\n",
       "    bias: const_103<48|float32>\n",
       "\n",
       "ID_4 clip_1 <PARENTS: msc.conv2d_bias_51| CHILDERN: msc.conv2d_bias_50>\n",
       "  IN: msc.conv2d_bias_51:0<1,48,112,112|float32>\n",
       "  OUT: clip_1:0<1,48,112,112|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_5 msc.conv2d_bias_50 <PARENTS: clip_1| CHILDERN: msc.conv2d_bias_49>\n",
       "  IN: clip_1:0<1,48,112,112|float32>\n",
       "  OUT: msc.conv2d_bias_50:0<1,24,112,112|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=24 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_100<24,48,1,1|float32>\n",
       "    bias: const_101<24|float32>\n",
       "\n",
       "ID_6 msc.conv2d_bias_49 <PARENTS: msc.conv2d_bias_50| CHILDERN: clip_2>\n",
       "  IN: msc.conv2d_bias_50:0<1,24,112,112|float32>\n",
       "  OUT: msc.conv2d_bias_49:0<1,144,112,112|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=144 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_98<144,24,1,1|float32>\n",
       "    bias: const_99<144|float32>\n",
       "\n",
       "ID_7 clip_2 <PARENTS: msc.conv2d_bias_49| CHILDERN: msc.conv2d_bias_48>\n",
       "  IN: msc.conv2d_bias_49:0<1,144,112,112|float32>\n",
       "  OUT: clip_2:0<1,144,112,112|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_8 msc.conv2d_bias_48 <PARENTS: clip_2| CHILDERN: clip_3>\n",
       "  IN: clip_2:0<1,144,112,112|float32>\n",
       "  OUT: msc.conv2d_bias_48:0<1,144,56,56|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=2,2 kernel_layout=OIHW groups=144 channels=144 kernel_size=3,3 axis=1 padding=0,0,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_96<144,1,3,3|float32>\n",
       "    bias: const_97<144|float32>\n",
       "\n",
       "ID_9 clip_3 <PARENTS: msc.conv2d_bias_48| CHILDERN: msc.conv2d_bias_47>\n",
       "  IN: msc.conv2d_bias_48:0<1,144,56,56|float32>\n",
       "  OUT: clip_3:0<1,144,56,56|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_10 msc.conv2d_bias_47 <PARENTS: clip_3| CHILDERN: msc.conv2d_bias_46,add>\n",
       "  IN: clip_3:0<1,144,56,56|float32>\n",
       "  OUT: msc.conv2d_bias_47:0<1,32,56,56|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=32 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_94<32,144,1,1|float32>\n",
       "    bias: const_95<32|float32>\n",
       "\n",
       "ID_11 msc.conv2d_bias_46 <PARENTS: msc.conv2d_bias_47| CHILDERN: clip_4>\n",
       "  IN: msc.conv2d_bias_47:0<1,32,56,56|float32>\n",
       "  OUT: msc.conv2d_bias_46:0<1,192,56,56|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=192 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_92<192,32,1,1|float32>\n",
       "    bias: const_93<192|float32>\n",
       "\n",
       "ID_12 clip_4 <PARENTS: msc.conv2d_bias_46| CHILDERN: msc.conv2d_bias_45>\n",
       "  IN: msc.conv2d_bias_46:0<1,192,56,56|float32>\n",
       "  OUT: clip_4:0<1,192,56,56|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_13 msc.conv2d_bias_45 <PARENTS: clip_4| CHILDERN: clip_5>\n",
       "  IN: clip_4:0<1,192,56,56|float32>\n",
       "  OUT: msc.conv2d_bias_45:0<1,192,56,56|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=192 channels=192 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_90<192,1,3,3|float32>\n",
       "    bias: const_91<192|float32>\n",
       "\n",
       "ID_14 clip_5 <PARENTS: msc.conv2d_bias_45| CHILDERN: msc.conv2d_bias_44>\n",
       "  IN: msc.conv2d_bias_45:0<1,192,56,56|float32>\n",
       "  OUT: clip_5:0<1,192,56,56|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_15 msc.conv2d_bias_44 <PARENTS: clip_5| CHILDERN: add>\n",
       "  IN: clip_5:0<1,192,56,56|float32>\n",
       "  OUT: msc.conv2d_bias_44:0<1,32,56,56|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=32 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_88<32,192,1,1|float32>\n",
       "    bias: const_89<32|float32>\n",
       "\n",
       "ID_16 add <PARENTS: msc.conv2d_bias_44,msc.conv2d_bias_47| CHILDERN: msc.conv2d_bias_43>\n",
       "  IN: msc.conv2d_bias_44:0<1,32,56,56|float32>,msc.conv2d_bias_47:0<1,32,56,56|float32>\n",
       "  OUT: add:0<1,32,56,56|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_17 msc.conv2d_bias_43 <PARENTS: add| CHILDERN: clip_6>\n",
       "  IN: add:0<1,32,56,56|float32>\n",
       "  OUT: msc.conv2d_bias_43:0<1,192,56,56|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=192 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_86<192,32,1,1|float32>\n",
       "    bias: const_87<192|float32>\n",
       "\n",
       "ID_18 clip_6 <PARENTS: msc.conv2d_bias_43| CHILDERN: msc.conv2d_bias_42>\n",
       "  IN: msc.conv2d_bias_43:0<1,192,56,56|float32>\n",
       "  OUT: clip_6:0<1,192,56,56|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_19 msc.conv2d_bias_42 <PARENTS: clip_6| CHILDERN: clip_7>\n",
       "  IN: clip_6:0<1,192,56,56|float32>\n",
       "  OUT: msc.conv2d_bias_42:0<1,192,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=2,2 kernel_layout=OIHW groups=192 channels=192 kernel_size=3,3 axis=1 padding=0,0,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_84<192,1,3,3|float32>\n",
       "    bias: const_85<192|float32>\n",
       "\n",
       "ID_20 clip_7 <PARENTS: msc.conv2d_bias_42| CHILDERN: msc.conv2d_bias_41>\n",
       "  IN: msc.conv2d_bias_42:0<1,192,28,28|float32>\n",
       "  OUT: clip_7:0<1,192,28,28|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_21 msc.conv2d_bias_41 <PARENTS: clip_7| CHILDERN: msc.conv2d_bias_40,add_1>\n",
       "  IN: clip_7:0<1,192,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_41:0<1,48,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=48 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_82<48,192,1,1|float32>\n",
       "    bias: const_83<48|float32>\n",
       "\n",
       "ID_22 msc.conv2d_bias_40 <PARENTS: msc.conv2d_bias_41| CHILDERN: clip_8>\n",
       "  IN: msc.conv2d_bias_41:0<1,48,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_40:0<1,288,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=288 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_80<288,48,1,1|float32>\n",
       "    bias: const_81<288|float32>\n",
       "\n",
       "ID_23 clip_8 <PARENTS: msc.conv2d_bias_40| CHILDERN: msc.conv2d_bias_39>\n",
       "  IN: msc.conv2d_bias_40:0<1,288,28,28|float32>\n",
       "  OUT: clip_8:0<1,288,28,28|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_24 msc.conv2d_bias_39 <PARENTS: clip_8| CHILDERN: clip_9>\n",
       "  IN: clip_8:0<1,288,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_39:0<1,288,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=288 channels=288 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_78<288,1,3,3|float32>\n",
       "    bias: const_79<288|float32>\n",
       "\n",
       "ID_25 clip_9 <PARENTS: msc.conv2d_bias_39| CHILDERN: msc.conv2d_bias_38>\n",
       "  IN: msc.conv2d_bias_39:0<1,288,28,28|float32>\n",
       "  OUT: clip_9:0<1,288,28,28|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_26 msc.conv2d_bias_38 <PARENTS: clip_9| CHILDERN: add_1>\n",
       "  IN: clip_9:0<1,288,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_38:0<1,48,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=48 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_76<48,288,1,1|float32>\n",
       "    bias: const_77<48|float32>\n",
       "\n",
       "ID_27 add_1 <PARENTS: msc.conv2d_bias_38,msc.conv2d_bias_41| CHILDERN: msc.conv2d_bias_37,add_2>\n",
       "  IN: msc.conv2d_bias_38:0<1,48,28,28|float32>,msc.conv2d_bias_41:0<1,48,28,28|float32>\n",
       "  OUT: add_1:0<1,48,28,28|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_28 msc.conv2d_bias_37 <PARENTS: add_1| CHILDERN: clip_10>\n",
       "  IN: add_1:0<1,48,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_37:0<1,288,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=288 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_74<288,48,1,1|float32>\n",
       "    bias: const_75<288|float32>\n",
       "\n",
       "ID_29 clip_10 <PARENTS: msc.conv2d_bias_37| CHILDERN: msc.conv2d_bias_36>\n",
       "  IN: msc.conv2d_bias_37:0<1,288,28,28|float32>\n",
       "  OUT: clip_10:0<1,288,28,28|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_30 msc.conv2d_bias_36 <PARENTS: clip_10| CHILDERN: clip_11>\n",
       "  IN: clip_10:0<1,288,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_36:0<1,288,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=288 channels=288 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_72<288,1,3,3|float32>\n",
       "    bias: const_73<288|float32>\n",
       "\n",
       "ID_31 clip_11 <PARENTS: msc.conv2d_bias_36| CHILDERN: msc.conv2d_bias_35>\n",
       "  IN: msc.conv2d_bias_36:0<1,288,28,28|float32>\n",
       "  OUT: clip_11:0<1,288,28,28|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_32 msc.conv2d_bias_35 <PARENTS: clip_11| CHILDERN: add_2>\n",
       "  IN: clip_11:0<1,288,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_35:0<1,48,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=48 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_70<48,288,1,1|float32>\n",
       "    bias: const_71<48|float32>\n",
       "\n",
       "ID_33 add_2 <PARENTS: msc.conv2d_bias_35,add_1| CHILDERN: msc.conv2d_bias_34>\n",
       "  IN: msc.conv2d_bias_35:0<1,48,28,28|float32>,add_1:0<1,48,28,28|float32>\n",
       "  OUT: add_2:0<1,48,28,28|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_34 msc.conv2d_bias_34 <PARENTS: add_2| CHILDERN: clip_12>\n",
       "  IN: add_2:0<1,48,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_34:0<1,288,28,28|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=288 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_68<288,48,1,1|float32>\n",
       "    bias: const_69<288|float32>\n",
       "\n",
       "ID_35 clip_12 <PARENTS: msc.conv2d_bias_34| CHILDERN: msc.conv2d_bias_33>\n",
       "  IN: msc.conv2d_bias_34:0<1,288,28,28|float32>\n",
       "  OUT: clip_12:0<1,288,28,28|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_36 msc.conv2d_bias_33 <PARENTS: clip_12| CHILDERN: clip_13>\n",
       "  IN: clip_12:0<1,288,28,28|float32>\n",
       "  OUT: msc.conv2d_bias_33:0<1,288,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=2,2 kernel_layout=OIHW groups=288 channels=288 kernel_size=3,3 axis=1 padding=0,0,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_66<288,1,3,3|float32>\n",
       "    bias: const_67<288|float32>\n",
       "\n",
       "ID_37 clip_13 <PARENTS: msc.conv2d_bias_33| CHILDERN: msc.conv2d_bias_32>\n",
       "  IN: msc.conv2d_bias_33:0<1,288,14,14|float32>\n",
       "  OUT: clip_13:0<1,288,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_38 msc.conv2d_bias_32 <PARENTS: clip_13| CHILDERN: msc.conv2d_bias_31,add_3>\n",
       "  IN: clip_13:0<1,288,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_32:0<1,88,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=88 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_64<88,288,1,1|float32>\n",
       "    bias: const_65<88|float32>\n",
       "\n",
       "ID_39 msc.conv2d_bias_31 <PARENTS: msc.conv2d_bias_32| CHILDERN: clip_14>\n",
       "  IN: msc.conv2d_bias_32:0<1,88,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_31:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=528 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_62<528,88,1,1|float32>\n",
       "    bias: const_63<528|float32>\n",
       "\n",
       "ID_40 clip_14 <PARENTS: msc.conv2d_bias_31| CHILDERN: msc.conv2d_bias_30>\n",
       "  IN: msc.conv2d_bias_31:0<1,528,14,14|float32>\n",
       "  OUT: clip_14:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_41 msc.conv2d_bias_30 <PARENTS: clip_14| CHILDERN: clip_15>\n",
       "  IN: clip_14:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_30:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=528 channels=528 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_60<528,1,3,3|float32>\n",
       "    bias: const_61<528|float32>\n",
       "\n",
       "ID_42 clip_15 <PARENTS: msc.conv2d_bias_30| CHILDERN: msc.conv2d_bias_29>\n",
       "  IN: msc.conv2d_bias_30:0<1,528,14,14|float32>\n",
       "  OUT: clip_15:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_43 msc.conv2d_bias_29 <PARENTS: clip_15| CHILDERN: add_3>\n",
       "  IN: clip_15:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_29:0<1,88,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=88 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_58<88,528,1,1|float32>\n",
       "    bias: const_59<88|float32>\n",
       "\n",
       "ID_44 add_3 <PARENTS: msc.conv2d_bias_29,msc.conv2d_bias_32| CHILDERN: msc.conv2d_bias_28,add_4>\n",
       "  IN: msc.conv2d_bias_29:0<1,88,14,14|float32>,msc.conv2d_bias_32:0<1,88,14,14|float32>\n",
       "  OUT: add_3:0<1,88,14,14|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_45 msc.conv2d_bias_28 <PARENTS: add_3| CHILDERN: clip_16>\n",
       "  IN: add_3:0<1,88,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_28:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=528 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_56<528,88,1,1|float32>\n",
       "    bias: const_57<528|float32>\n",
       "\n",
       "ID_46 clip_16 <PARENTS: msc.conv2d_bias_28| CHILDERN: msc.conv2d_bias_27>\n",
       "  IN: msc.conv2d_bias_28:0<1,528,14,14|float32>\n",
       "  OUT: clip_16:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_47 msc.conv2d_bias_27 <PARENTS: clip_16| CHILDERN: clip_17>\n",
       "  IN: clip_16:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_27:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=528 channels=528 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_54<528,1,3,3|float32>\n",
       "    bias: const_55<528|float32>\n",
       "\n",
       "ID_48 clip_17 <PARENTS: msc.conv2d_bias_27| CHILDERN: msc.conv2d_bias_26>\n",
       "  IN: msc.conv2d_bias_27:0<1,528,14,14|float32>\n",
       "  OUT: clip_17:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_49 msc.conv2d_bias_26 <PARENTS: clip_17| CHILDERN: add_4>\n",
       "  IN: clip_17:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_26:0<1,88,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=88 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_52<88,528,1,1|float32>\n",
       "    bias: const_53<88|float32>\n",
       "\n",
       "ID_50 add_4 <PARENTS: msc.conv2d_bias_26,add_3| CHILDERN: msc.conv2d_bias_25,add_5>\n",
       "  IN: msc.conv2d_bias_26:0<1,88,14,14|float32>,add_3:0<1,88,14,14|float32>\n",
       "  OUT: add_4:0<1,88,14,14|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_51 msc.conv2d_bias_25 <PARENTS: add_4| CHILDERN: clip_18>\n",
       "  IN: add_4:0<1,88,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_25:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=528 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_50<528,88,1,1|float32>\n",
       "    bias: const_51<528|float32>\n",
       "\n",
       "ID_52 clip_18 <PARENTS: msc.conv2d_bias_25| CHILDERN: msc.conv2d_bias_24>\n",
       "  IN: msc.conv2d_bias_25:0<1,528,14,14|float32>\n",
       "  OUT: clip_18:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_53 msc.conv2d_bias_24 <PARENTS: clip_18| CHILDERN: clip_19>\n",
       "  IN: clip_18:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_24:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=528 channels=528 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_48<528,1,3,3|float32>\n",
       "    bias: const_49<528|float32>\n",
       "\n",
       "ID_54 clip_19 <PARENTS: msc.conv2d_bias_24| CHILDERN: msc.conv2d_bias_23>\n",
       "  IN: msc.conv2d_bias_24:0<1,528,14,14|float32>\n",
       "  OUT: clip_19:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_55 msc.conv2d_bias_23 <PARENTS: clip_19| CHILDERN: add_5>\n",
       "  IN: clip_19:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_23:0<1,88,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=88 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_46<88,528,1,1|float32>\n",
       "    bias: const_47<88|float32>\n",
       "\n",
       "ID_56 add_5 <PARENTS: msc.conv2d_bias_23,add_4| CHILDERN: msc.conv2d_bias_22>\n",
       "  IN: msc.conv2d_bias_23:0<1,88,14,14|float32>,add_4:0<1,88,14,14|float32>\n",
       "  OUT: add_5:0<1,88,14,14|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_57 msc.conv2d_bias_22 <PARENTS: add_5| CHILDERN: clip_20>\n",
       "  IN: add_5:0<1,88,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_22:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=528 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_44<528,88,1,1|float32>\n",
       "    bias: const_45<528|float32>\n",
       "\n",
       "ID_58 clip_20 <PARENTS: msc.conv2d_bias_22| CHILDERN: msc.conv2d_bias_21>\n",
       "  IN: msc.conv2d_bias_22:0<1,528,14,14|float32>\n",
       "  OUT: clip_20:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_59 msc.conv2d_bias_21 <PARENTS: clip_20| CHILDERN: clip_21>\n",
       "  IN: clip_20:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_21:0<1,528,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=528 channels=528 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_42<528,1,3,3|float32>\n",
       "    bias: const_43<528|float32>\n",
       "\n",
       "ID_60 clip_21 <PARENTS: msc.conv2d_bias_21| CHILDERN: msc.conv2d_bias_20>\n",
       "  IN: msc.conv2d_bias_21:0<1,528,14,14|float32>\n",
       "  OUT: clip_21:0<1,528,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_61 msc.conv2d_bias_20 <PARENTS: clip_21| CHILDERN: msc.conv2d_bias_19,add_6>\n",
       "  IN: clip_21:0<1,528,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_20:0<1,136,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=136 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_40<136,528,1,1|float32>\n",
       "    bias: const_41<136|float32>\n",
       "\n",
       "ID_62 msc.conv2d_bias_19 <PARENTS: msc.conv2d_bias_20| CHILDERN: clip_22>\n",
       "  IN: msc.conv2d_bias_20:0<1,136,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_19:0<1,816,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=816 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_38<816,136,1,1|float32>\n",
       "    bias: const_39<816|float32>\n",
       "\n",
       "ID_63 clip_22 <PARENTS: msc.conv2d_bias_19| CHILDERN: msc.conv2d_bias_18>\n",
       "  IN: msc.conv2d_bias_19:0<1,816,14,14|float32>\n",
       "  OUT: clip_22:0<1,816,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_64 msc.conv2d_bias_18 <PARENTS: clip_22| CHILDERN: clip_23>\n",
       "  IN: clip_22:0<1,816,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_18:0<1,816,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=816 channels=816 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_36<816,1,3,3|float32>\n",
       "    bias: const_37<816|float32>\n",
       "\n",
       "ID_65 clip_23 <PARENTS: msc.conv2d_bias_18| CHILDERN: msc.conv2d_bias_17>\n",
       "  IN: msc.conv2d_bias_18:0<1,816,14,14|float32>\n",
       "  OUT: clip_23:0<1,816,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_66 msc.conv2d_bias_17 <PARENTS: clip_23| CHILDERN: add_6>\n",
       "  IN: clip_23:0<1,816,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_17:0<1,136,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=136 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_34<136,816,1,1|float32>\n",
       "    bias: const_35<136|float32>\n",
       "\n",
       "ID_67 add_6 <PARENTS: msc.conv2d_bias_17,msc.conv2d_bias_20| CHILDERN: msc.conv2d_bias_16,add_7>\n",
       "  IN: msc.conv2d_bias_17:0<1,136,14,14|float32>,msc.conv2d_bias_20:0<1,136,14,14|float32>\n",
       "  OUT: add_6:0<1,136,14,14|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_68 msc.conv2d_bias_16 <PARENTS: add_6| CHILDERN: clip_24>\n",
       "  IN: add_6:0<1,136,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_16:0<1,816,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=816 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_32<816,136,1,1|float32>\n",
       "    bias: const_33<816|float32>\n",
       "\n",
       "ID_69 clip_24 <PARENTS: msc.conv2d_bias_16| CHILDERN: msc.conv2d_bias_15>\n",
       "  IN: msc.conv2d_bias_16:0<1,816,14,14|float32>\n",
       "  OUT: clip_24:0<1,816,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_70 msc.conv2d_bias_15 <PARENTS: clip_24| CHILDERN: clip_25>\n",
       "  IN: clip_24:0<1,816,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_15:0<1,816,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=816 channels=816 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_30<816,1,3,3|float32>\n",
       "    bias: const_31<816|float32>\n",
       "\n",
       "ID_71 clip_25 <PARENTS: msc.conv2d_bias_15| CHILDERN: msc.conv2d_bias_14>\n",
       "  IN: msc.conv2d_bias_15:0<1,816,14,14|float32>\n",
       "  OUT: clip_25:0<1,816,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_72 msc.conv2d_bias_14 <PARENTS: clip_25| CHILDERN: add_7>\n",
       "  IN: clip_25:0<1,816,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_14:0<1,136,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=136 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_28<136,816,1,1|float32>\n",
       "    bias: const_29<136|float32>\n",
       "\n",
       "ID_73 add_7 <PARENTS: msc.conv2d_bias_14,add_6| CHILDERN: msc.conv2d_bias_13>\n",
       "  IN: msc.conv2d_bias_14:0<1,136,14,14|float32>,add_6:0<1,136,14,14|float32>\n",
       "  OUT: add_7:0<1,136,14,14|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_74 msc.conv2d_bias_13 <PARENTS: add_7| CHILDERN: clip_26>\n",
       "  IN: add_7:0<1,136,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_13:0<1,816,14,14|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=816 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_26<816,136,1,1|float32>\n",
       "    bias: const_27<816|float32>\n",
       "\n",
       "ID_75 clip_26 <PARENTS: msc.conv2d_bias_13| CHILDERN: msc.conv2d_bias_12>\n",
       "  IN: msc.conv2d_bias_13:0<1,816,14,14|float32>\n",
       "  OUT: clip_26:0<1,816,14,14|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_76 msc.conv2d_bias_12 <PARENTS: clip_26| CHILDERN: clip_27>\n",
       "  IN: clip_26:0<1,816,14,14|float32>\n",
       "  OUT: msc.conv2d_bias_12:0<1,816,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=2,2 kernel_layout=OIHW groups=816 channels=816 kernel_size=3,3 axis=1 padding=0,0,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_24<816,1,3,3|float32>\n",
       "    bias: const_25<816|float32>\n",
       "\n",
       "ID_77 clip_27 <PARENTS: msc.conv2d_bias_12| CHILDERN: msc.conv2d_bias_11>\n",
       "  IN: msc.conv2d_bias_12:0<1,816,7,7|float32>\n",
       "  OUT: clip_27:0<1,816,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_78 msc.conv2d_bias_11 <PARENTS: clip_27| CHILDERN: msc.conv2d_bias_10,add_8>\n",
       "  IN: clip_27:0<1,816,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_11:0<1,224,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=224 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_22<224,816,1,1|float32>\n",
       "    bias: const_23<224|float32>\n",
       "\n",
       "ID_79 msc.conv2d_bias_10 <PARENTS: msc.conv2d_bias_11| CHILDERN: clip_28>\n",
       "  IN: msc.conv2d_bias_11:0<1,224,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_10:0<1,1344,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=1344 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_20<1344,224,1,1|float32>\n",
       "    bias: const_21<1344|float32>\n",
       "\n",
       "ID_80 clip_28 <PARENTS: msc.conv2d_bias_10| CHILDERN: msc.conv2d_bias_9>\n",
       "  IN: msc.conv2d_bias_10:0<1,1344,7,7|float32>\n",
       "  OUT: clip_28:0<1,1344,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_81 msc.conv2d_bias_9 <PARENTS: clip_28| CHILDERN: clip_29>\n",
       "  IN: clip_28:0<1,1344,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_9:0<1,1344,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1344 channels=1344 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_18<1344,1,3,3|float32>\n",
       "    bias: const_19<1344|float32>\n",
       "\n",
       "ID_82 clip_29 <PARENTS: msc.conv2d_bias_9| CHILDERN: msc.conv2d_bias_8>\n",
       "  IN: msc.conv2d_bias_9:0<1,1344,7,7|float32>\n",
       "  OUT: clip_29:0<1,1344,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_83 msc.conv2d_bias_8 <PARENTS: clip_29| CHILDERN: add_8>\n",
       "  IN: clip_29:0<1,1344,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_8:0<1,224,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=224 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_16<224,1344,1,1|float32>\n",
       "    bias: const_17<224|float32>\n",
       "\n",
       "ID_84 add_8 <PARENTS: msc.conv2d_bias_8,msc.conv2d_bias_11| CHILDERN: msc.conv2d_bias_7,add_9>\n",
       "  IN: msc.conv2d_bias_8:0<1,224,7,7|float32>,msc.conv2d_bias_11:0<1,224,7,7|float32>\n",
       "  OUT: add_8:0<1,224,7,7|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_85 msc.conv2d_bias_7 <PARENTS: add_8| CHILDERN: clip_30>\n",
       "  IN: add_8:0<1,224,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_7:0<1,1344,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=1344 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_14<1344,224,1,1|float32>\n",
       "    bias: const_15<1344|float32>\n",
       "\n",
       "ID_86 clip_30 <PARENTS: msc.conv2d_bias_7| CHILDERN: msc.conv2d_bias_6>\n",
       "  IN: msc.conv2d_bias_7:0<1,1344,7,7|float32>\n",
       "  OUT: clip_30:0<1,1344,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_87 msc.conv2d_bias_6 <PARENTS: clip_30| CHILDERN: clip_31>\n",
       "  IN: clip_30:0<1,1344,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_6:0<1,1344,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1344 channels=1344 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_12<1344,1,3,3|float32>\n",
       "    bias: const_13<1344|float32>\n",
       "\n",
       "ID_88 clip_31 <PARENTS: msc.conv2d_bias_6| CHILDERN: msc.conv2d_bias_5>\n",
       "  IN: msc.conv2d_bias_6:0<1,1344,7,7|float32>\n",
       "  OUT: clip_31:0<1,1344,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_89 msc.conv2d_bias_5 <PARENTS: clip_31| CHILDERN: add_9>\n",
       "  IN: clip_31:0<1,1344,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_5:0<1,224,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=224 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_10<224,1344,1,1|float32>\n",
       "    bias: const_11<224|float32>\n",
       "\n",
       "ID_90 add_9 <PARENTS: msc.conv2d_bias_5,add_8| CHILDERN: msc.conv2d_bias_4>\n",
       "  IN: msc.conv2d_bias_5:0<1,224,7,7|float32>,add_8:0<1,224,7,7|float32>\n",
       "  OUT: add_9:0<1,224,7,7|float32>\n",
       "  OPTYPE: add\n",
       "  SCOPE: block\n",
       "\n",
       "ID_91 msc.conv2d_bias_4 <PARENTS: add_9| CHILDERN: clip_32>\n",
       "  IN: add_9:0<1,224,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_4:0<1,1344,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=1344 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_8<1344,224,1,1|float32>\n",
       "    bias: const_9<1344|float32>\n",
       "\n",
       "ID_92 clip_32 <PARENTS: msc.conv2d_bias_4| CHILDERN: msc.conv2d_bias_3>\n",
       "  IN: msc.conv2d_bias_4:0<1,1344,7,7|float32>\n",
       "  OUT: clip_32:0<1,1344,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_93 msc.conv2d_bias_3 <PARENTS: clip_32| CHILDERN: clip_33>\n",
       "  IN: clip_32:0<1,1344,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_3:0<1,1344,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1344 channels=1344 kernel_size=3,3 axis=1 padding=1,1,1,1 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_6<1344,1,3,3|float32>\n",
       "    bias: const_7<1344|float32>\n",
       "\n",
       "ID_94 clip_33 <PARENTS: msc.conv2d_bias_3| CHILDERN: msc.conv2d_bias_2>\n",
       "  IN: msc.conv2d_bias_3:0<1,1344,7,7|float32>\n",
       "  OUT: clip_33:0<1,1344,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_95 msc.conv2d_bias_2 <PARENTS: clip_33| CHILDERN: msc.conv2d_bias_1>\n",
       "  IN: clip_33:0<1,1344,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_2:0<1,448,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=448 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_4<448,1344,1,1|float32>\n",
       "    bias: const_5<448|float32>\n",
       "\n",
       "ID_96 msc.conv2d_bias_1 <PARENTS: msc.conv2d_bias_2| CHILDERN: clip_34>\n",
       "  IN: msc.conv2d_bias_2:0<1,448,7,7|float32>\n",
       "  OUT: msc.conv2d_bias_1:0<1,1792,7,7|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=1792 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const_2<1792,448,1,1|float32>\n",
       "    bias: const_3<1792|float32>\n",
       "\n",
       "ID_97 clip_34 <PARENTS: msc.conv2d_bias_1| CHILDERN: avg_pool2d>\n",
       "  IN: msc.conv2d_bias_1:0<1,1792,7,7|float32>\n",
       "  OUT: clip_34:0<1,1792,7,7|float32>\n",
       "  OPTYPE: clip\n",
       "  SCOPE: block\n",
       "  ATTRS: a_min=0.000000 a_max=6.000000 \n",
       "\n",
       "ID_98 avg_pool2d <PARENTS: clip_34| CHILDERN: reshape>\n",
       "  IN: clip_34:0<1,1792,7,7|float32>\n",
       "  OUT: avg_pool2d:0<1,1792,1,1|float32>\n",
       "  OPTYPE: nn.avg_pool2d\n",
       "  SCOPE: block\n",
       "  ATTRS: count_include_pad=0 strides=1,1 pool_size=7,7 ceil_mode=0 layout=NCHW padding=0,0,0,0 dilation=1,1 out_layout= \n",
       "\n",
       "ID_99 reshape <PARENTS: avg_pool2d| CHILDERN: msc.conv2d_bias>\n",
       "  IN: avg_pool2d:0<1,1792,1,1|float32>\n",
       "  OUT: reshape:0<1,1792,1,1|float32>\n",
       "  OPTYPE: reshape\n",
       "  SCOPE: block\n",
       "  ATTRS: newshape=1,1792,1,1 allowzero=0 \n",
       "\n",
       "ID_100 msc.conv2d_bias <PARENTS: reshape| CHILDERN: squeeze>\n",
       "  IN: reshape:0<1,1792,1,1|float32>\n",
       "  OUT: msc.conv2d_bias:0<1,1001,1,1|float32>\n",
       "  OPTYPE: msc.conv2d_bias\n",
       "  SCOPE: block\n",
       "  ATTRS: out_dtype= strides=1,1 kernel_layout=OIHW groups=1 channels=1001 kernel_size=1,1 axis=1 padding=0,0,0,0 data_layout=NCHW dilation=1,1 out_layout= \n",
       "  WEIGHTS: \n",
       "    weight: const<1001,1792,1,1|float32>\n",
       "    bias: const_1<1001|float32>\n",
       "\n",
       "ID_101 squeeze <PARENTS: msc.conv2d_bias| CHILDERN: reshape_1>\n",
       "  IN: msc.conv2d_bias:0<1,1001,1,1|float32>\n",
       "  OUT: squeeze:0<1,1001|float32>\n",
       "  OPTYPE: squeeze\n",
       "  SCOPE: block\n",
       "  ATTRS: axis=2,3 \n",
       "\n",
       "ID_102 reshape_1 <PARENTS: squeeze| CHILDERN: softmax>\n",
       "  IN: squeeze:0<1,1001|float32>\n",
       "  OUT: reshape_1:0<1,1001|float32>\n",
       "  OPTYPE: reshape\n",
       "  SCOPE: block\n",
       "  ATTRS: newshape=-1,1001 allowzero=0 \n",
       "\n",
       "ID_103 softmax <PARENTS: reshape_1| CHILDERN: reshape_2>\n",
       "  IN: reshape_1:0<1,1001|float32>\n",
       "  OUT: softmax:0<1,1001|float32>\n",
       "  OPTYPE: nn.softmax\n",
       "  SCOPE: block\n",
       "  ATTRS: axis=1 \n",
       "\n",
       "ID_104 reshape_2 <PARENTS: softmax| CHILDERN: >\n",
       "  IN: softmax:0<1,1001|float32>\n",
       "  OUT: reshape_2:0(reshape_2)<1,1001|float32>\n",
       "  OPTYPE: reshape\n",
       "  SCOPE: block\n",
       "  ATTRS: newshape=1,1001 allowzero=0 \n"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "tvmz",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
